Report post

What is a document Cookie?

document.cookie is a string, with key=value pairs separated by semicolons (;). the code you pasted looks for a specific key in the string, and then finding its value by looking for the end of the string, or the next semicolon, and returning the value it found

Does document Cookie Show special behavior?

Why not have a look at MDN? The string on the right side of the assignment operator to document.cookies should be a semicolon separated list of key-value pairs, i.e. document.cookie = "aKey=5" will set/update the aKey cookie. So yes, document.cookie shows special behavior.

Can a cookie be set to a domain?

If a cookie is set with path=/admin, it’s visible at pages /admin and /admin/something, but not at /home or /adminpage. Usually, we should set path to the root: path=/ to make the cookie accessible from all website pages. A domain defines where the cookie is accessible. In practice though, there are limitations. We can’t set any domain.

How do I see stored cookies?

Note: To see stored cookies (and other storage that a web page can use), you can enable the Storage Inspector in Developer Tools and select Cookies from the storage tree. After receiving an HTTP request, a server can send one or more Set-Cookie headers with the response.

Related articles

The World's Leading Crypto Trading Platform

Get my welcome gifts